/**
 * 
 */
package com.et114.components.mail;

import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;


/*
 * @author guanhw
 */
public class MailConfigUtil {
	private  static Configuration config; 
	private  String CONFIG_NAME = "mail.properties" ; 
	public  Configuration getConfiguration(  )  {
		if( config == null){
			try {
				config = new PropertiesConfiguration( getClass().getClassLoader()
						.getResource( CONFIG_NAME ) );
			} catch ( ConfigurationException e ) {
				e.printStackTrace();
			}
		}
		return config;
	}
	
	public  Configuration getConfiguration( String config_ )  {
		if( config == null){
			try {
				config = new PropertiesConfiguration( getClass().getClassLoader()
						.getResource( config_ ) );
			} catch ( ConfigurationException e ) {
				e.printStackTrace();
			}
		}
		return config;
	}	
	
	public static Configuration getConfig()   { 
		return new MailConfigUtil().getConfiguration() ;
	}
	
}
